package com.ourteam.education.api;

import com.ourteam.education.dao.LessonDAOQueryBean;
import com.ourteam.education.domain.LessonBean;
import com.ourteam.frame.web.AbstractSearchModel;

public class LessonSearchBean extends AbstractSearchModel<LessonDAOQueryBean> {

	private Long classId;

	public Long getClassId() {
		return classId;
	}

	public void setClassId(Long classId) {
		this.classId = classId;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return LessonBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(LessonDAOQueryBean queryBean) throws Exception {

		LessonDAOQueryBean.Criteria criteria = queryBean.createCriteria();

		if (this.classId != null && this.classId.longValue() != 0) {
			criteria.andClassIdEqualTo(classId);
		}

	}

}
